dojo.provide('app.form.FilteringSelect');
dojo.require('dijit.form.FilteringSelect');
dojo.declare('app.form.FilteringSelect',[dijit.form.FilteringSelect],{
	isValid:function(focused){
		return true;
	},
	_getValueField:function(){
		return 'id';
	},
	onChange:function(){
		if(!this.item)return;
		var prop = this.get('name');
		console.group(this.get('name') + '.' + '_onSelectChange');
		var idx = prop.lastIndexOf('.');
		idx = idx < 0 ? prop.length : idx;
		var pck = prop.substring(0, idx);
		var	data = app.model.prune(this.item.i, pck);
		for(d in data){
			var filtered = dojo.query('input', 'hiddenFields').filter(
					function(item) {
						var name = dojo.attr(item, 'name');
						return name === d;
					}
			);
			if(filtered.length){
				dojo.attr(filtered[0],'value',data[d]);
			}
		}
	}
})